﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace MvcShop.Models
{
    [MetadataType(typeof(GiftCardMetadata))]
    public partial class GiftCard
    {
    }

    public class GiftCardMetadata
    {
        [DisplayName("礼品卡密码")]
        [Required(ErrorMessage = "礼品卡密码不能为空。")]
        [StringLength(50, ErrorMessage = "礼品卡密码不能超过50字节。")]
        public string GiftCardKey { get; set; }

        [DisplayName("礼品卡卡号")]
        [Required(ErrorMessage = "礼品卡卡号不能为空。")]
        [StringLength(50, ErrorMessage = "礼品卡卡号不能超过50字节。")]
        public string GiftCardNo { get; set; }

        [DisplayName("礼品卡面值")]
        [Required(ErrorMessage = "礼品卡面值不能为空。")]
        [DataType(DataType.Currency,ErrorMessage="请输入正确的金额。")]
        public decimal GiftCardValue { get; set; }

        [DisplayName("是否使用")]
        [Required]
        public bool IsUsed { get; set; }

        [DisplayName("生成时间")]
        [DataType(DataType.DateTime)]
        public DateTime CreateTime { get; set; }

        [DisplayName("允值时间")]
        [DataType(DataType.DateTime)]
        public DateTime UsedTime { get; set; }

        [DisplayName("用户名")]
        [StringLength(50, ErrorMessage = "不能超过50字节。")]
        public string UserName { get; set; }
    }

    [MetadataType(typeof(UserAmountMetadata))]
    public partial class UserAmount
    { 
    }

    public class UserAmountMetadata
    {
        [DisplayName("用户名")]
        [Required(ErrorMessage = "用户名不能为空。")]
        [StringLength(50, ErrorMessage = "用户名不能超过50字节。")]
        public string UserName { get; set; }

        [DisplayName("账户金额")]
        [Required(ErrorMessage = "账户金额不能为空。")]
        [StringLength(225)]
        public string Amount { get; set; }
    }
}
